@use './variables.scss' as *;

// ==================== 滚动显示动画 ====================
// 基础显示类
[data-reveal] {
  opacity: 0;
  transition: all 0.6s ease-out;
}

.reveal-active {
  opacity: 1 !important;
  transform: none !important;
}

// 淡入效果
[data-reveal="fade"] {
  opacity: 0;
}

// 从下往上
[data-reveal="fade-up"] {
  opacity: 0;
  transform: translateY(30px);
}

// 从上往下
[data-reveal="fade-down"] {
  opacity: 0;
  transform: translateY(-30px);
}

// 从左往右
[data-reveal="fade-left"] {
  opacity: 0;
  transform: translateX(-30px);
}

// 从右往左
[data-reveal="fade-right"] {
  opacity: 0;
  transform: translateX(30px);
}

// 缩放效果
[data-reveal="zoom-in"] {
  opacity: 0;
  transform: scale(0.9);
}

[data-reveal="zoom-out"] {
  opacity: 0;
  transform: scale(1.1);
}

// 翻转效果
[data-reveal="flip-left"] {
  opacity: 0;
  transform: perspective(2500px) rotateY(-100deg);
}

[data-reveal="flip-right"] {
  opacity: 0;
  transform: perspective(2500px) rotateY(100deg);
}

// 延迟类
[data-reveal-delay="100"] { transition-delay: 0.1s; }
[data-reveal-delay="200"] { transition-delay: 0.2s; }
[data-reveal-delay="300"] { transition-delay: 0.3s; }
[data-reveal-delay="400"] { transition-delay: 0.4s; }
[data-reveal-delay="500"] { transition-delay: 0.5s; }
[data-reveal-delay="600"] { transition-delay: 0.6s; }

// ==================== 微交互动画 ====================
// 按钮点击波纹效果
.ripple-effect {
  position: relative;
  overflow: hidden;
  
  &::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
  }
  
  &:active::after {
    width: 300px;
    height: 300px;
  }
}

// 悬停提升效果
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  
  &:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  }
  
  &:active {
    transform: translateY(-2px);
  }
}

// 悬停放大效果
.hover-scale {
  transition: transform 0.3s ease;
  
  &:hover {
    transform: scale(1.05);
  }
  
  &:active {
    transform: scale(0.98);
  }
}

// 悬停旋转效果
.hover-rotate {
  transition: transform 0.3s ease;
  
  &:hover {
    transform: rotate(5deg);
  }
}

// 悬停发光效果
.hover-glow {
  transition: box-shadow 0.3s ease;
  
  &:hover {
    box-shadow: 0 0 20px rgba(64, 158, 255, 0.5);
  }
}

// 脉冲动画
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

// 弹跳动画
.bounce {
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

// 摇晃动画
.shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

// 闪烁动画
.blink {
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

// 渐进式加载动画
.stagger-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  
  &.stagger-active {
    opacity: 1;
    transform: translateY(0);
  }
}

// ==================== 淡入动画 ====================
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

// ==================== 缩放动画 ====================
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

// ==================== 滑入动画 ====================
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

// ==================== 脉冲动画 ====================
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

// ==================== 旋转动画 ====================
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

// ==================== 工具类 ====================
.fade-in {
  animation: fadeIn $transition-base $transition-ease;
}

.fade-in-up {
  animation: fadeInUp $transition-base $transition-ease;
}

.fade-in-down {
  animation: fadeInDown $transition-base $transition-ease;
}

.scale-in {
  animation: scaleIn $transition-base $transition-ease;
}

